package com.lineage.data.item_etcitem;

import com.lineage.data.executor.ItemExecutor;
import com.lineage.server.model.Instance.L1ItemInstance;
import com.lineage.server.model.Instance.L1PcInstance;
import com.lineage.server.model.Instance.L1PetInstance;
import com.lineage.server.serverpackets.S_Sound;
import com.lineage.server.serverpackets.ServerBasePacket;

public class Whistle extends ItemExecutor {
  public static ItemExecutor get() {
    return new Whistle();
  }
  
  public void execute(int[] data, L1PcInstance pc, L1ItemInstance item) {
    pc.sendPacketsX8((ServerBasePacket)new S_Sound(437));
    Object[] petList = pc.getPetList().values().toArray();
    Object[] array;
    int length = (array = petList).length;
    int i = 0;
    while (i < length) {
      Object petObject = array[i];
      if (petObject instanceof L1PetInstance) {
        L1PetInstance pet = (L1PetInstance)petObject;
        pet.call();
      } 
      i++;
    } 
  }
}
